<?php

namespace App\Http\Requests\Admin\Panx\Product;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ProductModelUpdateRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $id = last(explode('/', $this->Url()));

        return [
//            'customer_id' => 'required|numeric',
            'category_id' => 'required|numeric',
            'name'        => ['required', 'string', Rule::unique('product_mods', 'name')->ignore($id)],
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
////            'customer_id.*' => '代理客户的id必须是数值',
//            'category_id.*' => '商品类型的id必须是数值',
//            'name.*'        => '商品模型的名称必须是字符串',
//        ];
//    }
}
